<?php
/**
 * Controller class file.
 *
 * @author Zhang Jinlong <466028373@qq.com>
 * @link http://www.ijianzhi.cn
 * @copyright Copyright &copy; 2013 DianJin Soft
 */

class Model extends CActiveRecord
{
    /**
     * (non-PHPdoc)
     * @see CActiveRecord::beforeSave()
     */
    public function beforeSave()
    {
        if ($this->isNewRecord && isset($this->addtime) && isset($this->addip))
        {
            $this->addtime = time();
            $this->addip = WebHelper::getIp();
        }

        if (isset($this->updatetime) && isset($this->updateip))
        {
            $this->updatetime = time();
            $this->updateip =  WebHelper::getIp();
        }

        return TRUE;
    }
}